package com.au.bescene.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.au.bescene.R;
import com.au.bescene.entity.Event;

/**
 * Adapter for PhotoGalleryList.
 * @author Khaled
 *
 */
public class PhotoGalleryListAdapter extends ArrayAdapter<Event> {
	private final Activity _context;
	private final ArrayList<Event> _events;

	public PhotoGalleryListAdapter(Activity context, ArrayList<Event> events) {
		super(context, R.layout.photogallerylist_item, events);
		_context = context;
		_events = events;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = _context.getLayoutInflater();
		View rowView = inflater.inflate(R.layout.photogallerylist_item, null, true);
		
		TextView textView = (TextView) rowView.findViewById(R.id.photogallerylist_textView);
		textView.setText(_events.get(position).getName());
        
		Typeface futura = Typeface.createFromAsset(_context.getAssets(), "fonts/futura_lt.ttf");
        
		textView.setTypeface(futura);
		textView.setTextSize(25.f);
		textView.setTextColor(Color.WHITE);
		
		TextView textViewSub = (TextView) rowView.findViewById(R.id.photogallerylist_textViewSub);
		
		textViewSub.setText(_events.get(position).getDate().getDate() + "-" + _events.get(position).getDate().getMonth() + "-" + _events.get(position).getDate().getYear());
		textViewSub.setTypeface(futura);
		textViewSub.setTextSize(15.f);
		textViewSub.setTextColor(Color.GRAY);
							
		return rowView;
	}
}
